<?php

namespace app\v1\model;

use think\Model;
use think\model\concern\SoftDelete;

class QuestionOptionResult extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';

    public function getAll()
    {
        $all_data = $this->select();
        foreach ($all_data as &$item) {
            // $a = Question::whereIn('id', $item['question_id_concat'])->select();
            $arrOpt = Option::whereIn('id', $item['option_id_concat'])->column('option');
            $item['option'] = implode(',', $arrOpt);
            $arrCountryIntro = CountryIntro::whereIn('id', $item['country_intro_id_concat'])->column('name');
            $item['country_intro'] = implode(',', $arrCountryIntro);
        }
        return $all_data;
    }
}
